/// @file Particle.cpp
/// @brief the parent class that represents a particle in space and used to represent all entities, such as the fluid particle and rbd

#include "Particle.h"

Particle::Particle()
{
    Particle::Particle(0, 0, 0, 0, 0);
}

Particle::Particle(const Particle& _particle)
{
    m_id = _particle.getId();

    m_mass = _particle.getMass();

    m_position = _particle.getPosition();
    m_lastPosition = m_position;

    m_velocity = _particle.getVelocity();
    m_lastVelocity = m_velocity;

    m_acceleration = _particle.getAcceleration();
    m_lastAcceleration = m_acceleration;

    m_netForce = _particle.getNetForce();

    m_moveable = _particle.getMoveable();

    m_radius = _particle.getRadius();

    m_colour = _particle.getColour();
}

Particle::Particle
            (
                const int _id,
                const ngl::Real _mass,
                const ngl::Vector _position,
                const ngl::Colour _colour,
                const ngl::Real _radius,
                const bool _moveable,
                const ngl::Vector _velocity,
                const ngl::Vector _acceleration,
                const ngl::Vector _netForce
            )
{
    //init params
    m_id = _id;

    m_mass = _mass;

    m_position = _position;
    m_lastPosition = m_position;

    m_velocity = _velocity;
    m_lastVelocity = m_velocity;

    m_acceleration = _acceleration;
    m_lastAcceleration = m_acceleration;

    m_netForce = _netForce;

    m_moveable = _moveable;

    m_radius = _radius;

    m_colour = _colour;
}

Particle::~Particle()
{
}

void Particle::setPosition(const ngl::Vector _p)
{
    //set positions to new value
    m_lastPosition = _p;
    m_position = _p;
}

void Particle::updatePosition(const ngl::Vector _p)
{
    //save current value
    m_lastPosition = m_position;

    //update to new value
    m_position = _p;
}

void Particle::setVelocity(const ngl::Vector _v)
{
    //set velocities to new value
    m_lastVelocity = _v;
    m_velocity = _v;
}

void Particle::updateVelocity(const ngl::Vector _v)
{
    //save current value
    m_lastVelocity = m_velocity;

    //update to new value
    m_velocity = _v;
}

void Particle::setAcceleration(const ngl::Vector _a)
{
    //set velocities to new value
    m_lastAcceleration = _a;
    m_acceleration = _a;
}

void Particle::updateAcceleration(const ngl::Vector _a)
{
    //save current value
    m_lastAcceleration = m_acceleration;

    //update to new value
    m_acceleration = _a;
}
